﻿<Page x:Class="AzureDriverExplorer_Client.VHDBackupDelete"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration" 
    xmlns:winForms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
        Title="Connection" Height="auto" Width="auto">


    <Page.Resources>

        <!-- This style is used for buttons, to remove the WPF default 'animated' mouse over effect -->
        <Style x:Key="StyleCancelBotton" TargetType="Button">
            <Setter Property="OverridesDefaultStyle" Value="True"/>
            <Setter Property="Margin" Value="1"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Border Name="border" 
                            BorderThickness="1"                             
                            BorderBrush="Red" 
                            CornerRadius="3"
                           Background="#32E1DFCD">
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="border" Property="BorderBrush" Value="Black" />
                                <Setter TargetName="border" Property="Background" Value="#4BEA0000" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!-- This style is used for buttons, to remove the WPF default 'animated' mouse over effect -->
        <Style x:Key="StyleAddBotton" TargetType="Button">
            <Setter Property="OverridesDefaultStyle" Value="True"/>
            <Setter Property="Margin" Value="1"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Border Name="border" 
                            BorderThickness="1"                             
                            BorderBrush="Green" 
                            CornerRadius="3"
                           Background="Transparent">
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="border" Property="BorderBrush" Value="Black" />

                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Page.Resources>
    <Grid  Background="#7C000000" >
        <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
            <Grid.RowDefinitions>
                <RowDefinition Height="20" />
                <RowDefinition Height="auto" />
            </Grid.RowDefinitions>
            <Grid Grid.Row="0" Background="#FF929292"  >
                <Image HorizontalAlignment="Right" VerticalAlignment="Stretch"  Height="20" Width="20" Source="/AzureDriverExplorer_Client;component/Image/Cancel.png" />
                <Button   Height="20" Width="19" Style="{StaticResource StyleCancelBotton}"  HorizontalAlignment="Right" VerticalAlignment="Stretch" Click="Close_popupVHDBackupDelete_Click" />
            </Grid>
            <Grid Background="White" Grid.Row="1" Height="353" Width="728">
                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />

                </Grid.RowDefinitions>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Image Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"  Height="30" Width="30" Source="/AzureDriverExplorer_Client;component/Image/connections.png" />
                    <Button Grid.Column="0"    Height="30" Width="30" Style="{StaticResource StyleAddBotton}"  HorizontalAlignment="Left" VerticalAlignment="Center" Click="ShowPopupConnection">
                    </Button>
                    <Image  Name="BackgroundImageLocalList" Grid.Row="1"   Margin="0,0,1,1" Source="/AzureDriverExplorer_Client;component/Image/vhdUpload.png" OpacityMask="#3E000000" />
                    <ListView Background="#40F0F8FF" Grid.Row="1" x:Name="ListConnection" SelectionMode="Single">
                        <ListView.Resources>
                            <ContextMenu x:Key="resourceContextMenu" Opened="ListViewAzureMenu_Opened">

                                <MenuItem   Header="Backup"  Tag="{Binding}" Click="BackupMenu_Click"   >
                                    <MenuItem.Icon>
                                        <Image Source="/AzureDriverExplorer_Client;component/Image/vhdBackup.png" Width="16"  />
                                    </MenuItem.Icon>
                                </MenuItem>
                                <MenuItem   Header="Delete"  Tag="{Binding}" Click="DeleteMenu_Click"    >
                                    <MenuItem.Icon>
                                        <Image Source="/AzureDriverExplorer_Client;component/Image/delete_file.png" Width="16"  />
                                    </MenuItem.Icon>
                                </MenuItem>
                            </ContextMenu>
                        </ListView.Resources>
                        <ListView.ItemContainerStyle>
                            <Style TargetType="{x:Type ListViewItem}">
                                <Setter Property="ContextMenu" Value="{StaticResource resourceContextMenu}" />
                            </Style>
                        </ListView.ItemContainerStyle>

                        <ListView.View>
                            <GridView AllowsColumnReorder="true"  ColumnHeaderToolTip="InfoFile" >
                                <GridViewColumn Width="250" >
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate >
                                            <Grid>
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="27" />
                                                    <ColumnDefinition Width="Auto" />
                                                </Grid.ColumnDefinitions>
                                                <Image Width="20" Grid.Column="0" Source="/AzureDriverExplorer_Client;component/Image/vhdUpload.png" />
                                                <TextBlock Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Right"  Text="{Binding Name}" />

                                            </Grid>
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>
                                    <GridViewColumnHeader Click="SortLocalClick" Tag="Name" Content="VHD Name" x:Name="VHDName" />
                                </GridViewColumn>
                                <GridViewColumn Width="150" Header="Bytes" x:Name="Bytes" >
                                    <GridViewColumn.CellTemplate>
                                        <DataTemplate >
                                            <Grid >
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="100" />
                                                    <ColumnDefinition Width="50" />
                                                </Grid.ColumnDefinitions>
                                                <TextBlock Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Text="{Binding Size}" />
                                                <TextBlock Grid.Column="1" VerticalAlignment="Center" Text=" Bytes"  />
                                                <TextBlock Grid.Column="0" Text="{Binding Path}" Visibility="Hidden" />
                                            </Grid>
                                        </DataTemplate>
                                    </GridViewColumn.CellTemplate>

                                </GridViewColumn>

                            </GridView>
                        </ListView.View>
                    </ListView>
                </Grid>            
            </Grid>
        </Grid>
        <Grid x:Name="popupConnection" Background="#7C000000" Visibility="Hidden">

            <Grid Background="White" Height="150" Width="400" HorizontalAlignment="Center" VerticalAlignment="Center">

                <Grid.RowDefinitions>
                    <RowDefinition Height="30" />
                    <RowDefinition Height="*" />
                    <RowDefinition Height="*" />

                    <RowDefinition Height="10" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto" />
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>
                <Grid Grid.Row="0" Grid.ColumnSpan="2"  Background="#FFDEDEDE">
                    <TextBlock x:Name="TitleConecction" Text="Connection Data" VerticalAlignment="Center" FontWeight="Bold" FontSize="14"></TextBlock>
                </Grid>
                <TextBlock x:Name="ConnectionAccountName" Grid.Column="0" Grid.Row="1"  VerticalAlignment="Center"  Text="Account Name" />
                <TextBlock x:Name="ConnectionAccountKey" Grid.Column="0" Grid.Row="2" VerticalAlignment="Center"  Text="Account Key" />


                <TextBox x:Name="txtAccountName" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left" Width="280" BorderBrush="AliceBlue"></TextBox>
                <Button x:Name="AddDataFile" Grid.Column="1" Grid.Row="1"  VerticalAlignment="Center" Width="20" HorizontalAlignment="Right" Click="popupGetDataFile_Click" >
                    <Image Source="/AzureDriverExplorer_Client;component/Image/Get_list.png" />
                </Button>

                <PasswordBox x:Name="txtAccountKey" PasswordChar="*" Grid.Column="1" Grid.Row="2" Width="280" HorizontalAlignment="Left" BorderBrush="AliceBlue"></PasswordBox>


                <Grid  Grid.Row="6" Grid.ColumnSpan="2"  HorizontalAlignment="Center" Width="330">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="110" />
                        <ColumnDefinition Width="110" />
                        <ColumnDefinition Width="110" />
                    </Grid.ColumnDefinitions>
                    <Button x:Name="BtConnection" Content="Connection" Width="100" Grid.Column="0" Click="Connection_Click"></Button>
                    <Button x:Name="BtClear" Content="Clear" Width="100" Grid.Column="1" Click="Clear_Connection_Click"></Button>
                    <Button x:Name="BtCancelar" Content="Cancel" Width="100" Grid.Column="2" Click="Cancel_Connection_Click"></Button>
                </Grid >

            </Grid>

            <Grid x:Name="popupGetDataFile"  Background="White"  Visibility="Hidden"  Height="150" Width="400" HorizontalAlignment="Center" VerticalAlignment="Center">

                <Grid.RowDefinitions>
                    <RowDefinition Height="*" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <ListView Background="White"  Grid.Row="0" x:Name="ListConnectionConfig" SelectionMode="Single">
                    <ListView.View>
                        <GridView AllowsColumnReorder="true"  ColumnHeaderToolTip="InfoFile" >
                            <GridViewColumn Width="100" Header="Account Name" x:Name="DataAccountName" >
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate >
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="Auto" />
                                            </Grid.ColumnDefinitions>
                                            <TextBlock Grid.Column="0" VerticalAlignment="Center"  Text="{Binding AccountName}"  />
                                            <TextBlock Grid.Column="0" VerticalAlignment="Center"  Text="{Binding AccountKey}" Visibility="Hidden" />
                                        </Grid>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>

                            </GridViewColumn>

                            <GridViewColumn Width="130" Header="Container Name" x:Name="DataContainerName" >
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate >
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="Auto" />
                                            </Grid.ColumnDefinitions>
                                            <TextBlock Grid.Column="0" VerticalAlignment="Center"  Text="{Binding ContainerName}" />
                                        </Grid>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>

                            </GridViewColumn>
                            <GridViewColumn Width="150" Header="VHD Name" x:Name="DataVHDName" >
                                <GridViewColumn.CellTemplate>
                                    <DataTemplate >
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="Auto" />
                                            </Grid.ColumnDefinitions>
                                            <TextBlock Grid.Column="0" VerticalAlignment="Center"  Text="{Binding VHDName}" />
                                        </Grid>
                                    </DataTemplate>
                                </GridViewColumn.CellTemplate>

                            </GridViewColumn>
                        </GridView>
                    </ListView.View>
                </ListView>
                <Grid Grid.Row="1" HorizontalAlignment="Center" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <Button x:Name="GetAdd" Content="Add" Width="70" Grid.Column="0" Click="Add_popupGetDataFile_Click"></Button>
                    <Button x:Name="GetCancel" Content="Cancel" Width="70" Grid.Column="1" Click="Close_popupGetDataFile_Click"></Button>

                </Grid>
            </Grid>
            
        </Grid>
        <Grid x:Name="popupLoad" Background="#7C000000" Visibility="Collapsed">
                    <Grid Background="White" Height="50" Width="50" HorizontalAlignment="Center" VerticalAlignment="Center">
                        <wfi:WindowsFormsHost>
                            <winForms:PictureBox x:Name="pictureBoxLoading">
                            </winForms:PictureBox>
                        </wfi:WindowsFormsHost>
                    </Grid>
                </Grid>
        <Grid x:Name="popupBackup" Background="#7C000000" Visibility="Hidden">

                    <Grid Background="White" Height="150" Width="400" HorizontalAlignment="Center" VerticalAlignment="Center">

                        <Grid.RowDefinitions>
                            <RowDefinition Height="30" />
                            <RowDefinition Height="*" />


                            <RowDefinition Height="10" />
                            <RowDefinition Height="*" />
                            <RowDefinition Height="10" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <Grid Grid.Row="0" Grid.ColumnSpan="2"  Background="#FFDEDEDE">
                    <TextBlock x:Name="BackupVHD" Text="Backup VHD" VerticalAlignment="Center" FontWeight="Bold" FontSize="14"></TextBlock>
                        </Grid>
                        <Button x:Name="txtFile" Grid.ColumnSpan="2" Content="Select Out Folder" Grid.Row="1" Background="#2F000000" Click="txtFile_Click"  BorderBrush="AliceBlue"></Button>


                        <Grid  Grid.Row="3" Grid.ColumnSpan="2"  HorizontalAlignment="Center" Width="220">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="110" />

                                <ColumnDefinition Width="110" />
                            </Grid.ColumnDefinitions>
                            <Button x:Name="StartBuckup"  Content="Start" Width="100" Grid.Column="0" Click="StartBackup_Click"></Button>
                            <Button x:Name="Cancel_backup" Content="Cancel" Width="100" Grid.Column="1" Click="Cancel_backup_Click"></Button>
                        </Grid >

                        <Grid x:Name="ProgressGrid" Grid.ColumnSpan="2" Grid.Row="5" Visibility="Hidden" Width="200">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"  />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <ProgressBar x:Name="ProgressBackup" Grid.Column="0"   Height="20"  OpacityMask="{x:Null}" BorderBrush="{Binding ColorFill}" Background="#E6E1DFCD"  />
                            <TextBlock x:Name="txtProgress"  Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center"   />
                            <Image Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Stretch"  Height="20" Width="20" Source="/AzureDriverExplorer_Client;component/Image/Cancel.png" />
                            <Button Grid.Column="1"  Height="20" Width="19" Style="{StaticResource StyleCancelBotton}"  HorizontalAlignment="Right" VerticalAlignment="Stretch" Click="Cancel_Download_Click" />
                        </Grid>
                    </Grid>


                </Grid>                   
    </Grid>
</Page>
